#ifndef SINGLETONTYPEEXAMPLE_H
#define SINGLETONTYPEEXAMPLE_H

#include <QObject>

class SingletonTypeExample : public QObject
{
    Q_OBJECT
    Q_PROPERTY (int someProperty READ someProperty WRITE setSomeProperty NOTIFY somePropertyChanged)

public:
    SingletonTypeExample(QObject* parent = 0)
        : QObject(parent), m_someProperty(0)
    {
    }

    ~SingletonTypeExample() {}

    // Q_INVOKABLE 可在qml中调用
    Q_INVOKABLE int doSomething();

    int someProperty() const { return m_someProperty; }
    void setSomeProperty(int val) { m_someProperty = val; emit somePropertyChanged(val); }

signals:
    void somePropertyChanged(int newValue);

private:
    int m_someProperty;
};

#endif // SINGLETONTYPEEXAMPLE_H
